package com.yanqu.road.server.cmd.cricket;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cricket.CricketProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cricketcourt.CrossCricketCourtMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CRICKET_DEFENSE_RANK_SCORE_UPDATE, desc = "同步游戏服的积分到跨服")
public class CrossCricketDefenseRankScoreUpdateCmd extends CrossCommand {

    private long userId;

    private long rankScore;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CricketProto.CricketDefenseRankScoreUpdateReqMsg reqMsg = CricketProto.CricketDefenseRankScoreUpdateReqMsg.parseFrom(packet.getBytes());
        userId = reqMsg.getUserId();
        rankScore = reqMsg.getRankScore();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossCricketCourtMgr.scoreChange(serverId, userId, rankScore);
    }

    @Override
    public void sendData() {

    }
}
